package stc.skymobi.bean.esb.core;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;


/**
 * tlv格式的ua信息
 * @author Bluces.Wang@sky-mobi.com
 *
 */
public class TerminalUserAgentTLV implements Cloneable {
	
	private String factoryCode;

	private String terminalCode;

	private long vmv;

	private long hsv;

	private short screenSizeWidth;

	private short screenSizeHeight;

	private short terminalMemory;

	private String imei;

	private String imsi;
 
	private long entrance;
	
	private long appid;
	
	private int appver;
	
	private byte platform;
	
	private String ipAddress;
	
	private String channelSymbol;
	
	private String terminalID;
	
    public String toString() {
        
        return  ToStringBuilder.reflectionToString(this, 
                            ToStringStyle.SHORT_PREFIX_STYLE);
    }
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((factoryCode == null) ? 0 : factoryCode.hashCode());
		result = prime * result + (int)hsv;
		result = prime * result + ((imei == null) ? 0 : imei.hashCode());
		result = prime * result + ((imsi == null) ? 0 : imsi.hashCode());
		result = prime * result + screenSizeHeight;
		result = prime * result + screenSizeWidth;
		result = prime * result
				+ ((terminalCode == null) ? 0 : terminalCode.hashCode());
		result = prime * result + terminalMemory;
		result = prime * result + (int)vmv;
		
		result = prime * result + (int)entrance;
		result = prime * result + (int)appid;
		result = prime * result + appver;
		result = prime * result + platform;
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		TerminalUserAgentTLV other = (TerminalUserAgentTLV) obj;
		if (factoryCode == null) {
			if (other.factoryCode != null)
				return false;
		} else if (!factoryCode.equals(other.factoryCode))
			return false;
		if (hsv != other.hsv)
			return false;
		if (imei == null) {
			if (other.imei != null)
				return false;
		} else if (!imei.equals(other.imei))
			return false;
		if (imsi == null) {
			if (other.imsi != null)
				return false;
		} else if (!imsi.equals(other.imsi))
			return false;
		if (screenSizeHeight != other.screenSizeHeight)
			return false;
		if (screenSizeWidth != other.screenSizeWidth)
			return false;
		if (terminalCode == null) {
			if (other.terminalCode != null)
				return false;
		} else if (!terminalCode.equals(other.terminalCode))
			return false;
		if (terminalMemory != other.terminalMemory)
			return false;
		if (vmv != other.vmv)
			return false;
		
		if (entrance != other.entrance)
			return false;
		if (appid != other.appid)
			return false;
		if (appver != other.appver)
			return false;
		if (platform != other.platform)
			return false;

		return true;
	}

	@Override
	public TerminalUserAgentTLV clone() throws CloneNotSupportedException {
		return (TerminalUserAgentTLV)super.clone();
	}


	public String getFactoryCode() {
		return factoryCode;
	}


	public void setFactoryCode(String factoryCode) {
		this.factoryCode = factoryCode;
	}


	public long getHsv() {
		return hsv;
	}


	public void setHsv(int hsv) {
		this.hsv = hsv;
	}


	public String getTerminalCode() {
		return terminalCode;
	}


	public void setTerminalCode(String terminalCode) {
		this.terminalCode = terminalCode;
	}


	public long getVmv() {
		return vmv;
	}


	public void setVmv(int vmv) {
		this.vmv = vmv;
	}


	public short getScreenSizeWidth() {
		return screenSizeWidth;
	}


	public void setScreenSizeWidth(short screenSizeWidth) {
		this.screenSizeWidth = screenSizeWidth;
	}


	public short getScreenSizeHeight() {
		return screenSizeHeight;
	}


	public void setScreenSizeHeight(short screenSizeHeight) {
		this.screenSizeHeight = screenSizeHeight;
	}


	public short getTerminalMemory() {
		return terminalMemory;
	}


	public void setTerminalMemory(short terminalMemory) {
		this.terminalMemory = terminalMemory;
	}


	public String getImei() {
		return imei;
	}


	public void setImei(String imei) {
		this.imei = imei;
	}


	public String getImsi() {
		return imsi;
	}


	public void setImsi(String imsi) {
		this.imsi = imsi;
	}


	public long getEntrance() {
		return entrance;
	}


	public void setEntrance(long entrance) {
		this.entrance = entrance;
	}


	public long getAppid() {
		return appid;
	}


	public void setAppid(long appid) {
		this.appid = appid;
	}


	public int getAppver() {
		return appver;
	}


	public void setAppver(int appver) {
		this.appver = appver;
	}


	public byte getPlatform() {
		return platform;
	}


	public void setPlatform(byte platform) {
		this.platform = platform;
	}


	public String getIpAddress() {
		return ipAddress;
	}


	public void setIpAddress(String ipAddress) {
		this.ipAddress = ipAddress;
	}


	public String getChannelSymbol() {
		return channelSymbol;
	}


	public void setChannelSymbol(String channelSymbol) {
		this.channelSymbol = channelSymbol;
	}


	public String getTerminalID() {
		return terminalID;
	}


	public void setTerminalID(String terminalID) {
		this.terminalID = terminalID;
	}


	public void setVmv(long vmv) {
		this.vmv = vmv;
	}


	public void setHsv(long hsv) {
		this.hsv = hsv;
	}
    
}
